package com.hnn.gateway.demo.config;

import org.springframework.cloud.gateway.filter.factory.StripPrefixGatewayFilterFactory;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author hnn
 * @version 1.0
 * @date 2023-11-09 13:11
 */
@Configuration
public class GateWayConfig {

    @Bean
    public RouteLocator controlLocator(RouteLocatorBuilder builder) {
        return builder.routes()
                .route("idd",r->r.path("/swallow/**")
                        //.filters(f->f.filter(new StripPrefixGatewayFilterFactory().apply(c->c.setParts(1))))
                        .uri("http://192.168.20.168:9501")


                ).build();
    }
}
